package com.xu.jmm;

/**
 * 测试java内存模型 可见性
 */
public class VisibilityDemo1 {

    static volatile  boolean run = true;

    public static void main(String[] args) throws InterruptedException {
       Thread t = new Thread(()->{
            while (run){
                System.out.println("打印-----------------------"+run);
            }
            System.out.println(run);
        });
        t.start();
        Thread.sleep(10);
        run = false;
    }
}
